// 定义链表结构
class ListNode {
    constructor(value) {
        this.val = value;
        this.next = next;
    }
    val;
    next = null;
}

var removeElements = function(head, val) {
    const dummy = new ListNode(0, head);
    let cur = dummy;
    while (cur.next) {
        if (cur.next.val === val) {
            cur.next = cur.next.next;
            continue;
        }
        cur = cur.next;
    }
    return cur.next;
}

